<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="${ctxStatic}/layui-v2.5.6/layui/css/layui.css">
<script type="text/javascript" src="${ctxStatic}/layui-v2.5.6/layui/layui.js"></script>
<!--引入CSS-->
<%-- <link rel="stylesheet" href="${ctxStatic}/webuploader-0.1.5/webuploader.css">  --%>
<link rel="stylesheet" type="text/css" href="${ctxStatic}/webuploader-0.1.5/webuploader.css">
<!--引入JS-->
<script type="text/javascript " src="${ctxStatic}/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript" src="${ctxStatic}/webuploader-0.1.5/webuploader.js"></script> 
<script type="text/javascript" src="${ctxStatic}/ft/investmentDecisions.js" ></script>
<!--SWF在初始化的时候指定，在后面将展示-->	 
<script type="text/javascript">
var ctxStatic = "${ctxStatic}";
var ctx = "${ctx}";
</script>
<style type="text/css">
 
 #filePicker {
    display: block;
    margin: 6px;
 } 
 
 /* 确认上传按钮 */
 #sureUploadFile {
   margin: 6px;
   height: 38px;
   padding: 0 20px;
   display: block;
   color: #fff;
   text-align: center;
   cursor: pointer;
   background-color: rgba(76, 175, 80, .9);
   border: none;
 }
 </style>
 </head>
<body>

<div style="margin: 10px;">
	<form class="layui-form layui-form-pane" lay-filter="example"> 
		<div class="layui-form-item">
		 	 <input type="hidden" name="id">
		</div> 
	 	<div class="layui-form-item">
			 <label class="layui-form-label">项目名称:</label>
			   	 <div class="layui-input-inline">
				     <select name="name" lay-search="" required  lay-verify="required">
				      	<option value="">请选择</option>
							<c:forEach items="${fns:getDictList('qc_investmentDecisions_name')}" var="name">
								<option value="${name.value}">${name.label}</option>
							</c:forEach>
					  </select>
			    </div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label"> 类别：</label>
		    <div class="layui-input-inline">
		      <input type="text" name="category" id="category" autocomplete="off" class="layui-input">
		    </div>
		</div>
	 
	 	<div class="layui-form-item">
		    <label class="layui-form-label">决策阶段:</label>
			    <div class="layui-input-inline">
			      <select name="phase" lay-search="" required  lay-verify="required">
			      	<option value="">请选择</option>
						<c:forEach items="${fns:getDictList('qc_investmentDecisions_phase')}" var="phase">
							<option value="${phase.value}">${phase.label}</option>
						</c:forEach>
				  </select>
			    </div>
		    <label class="layui-form-label">是否通过:</label>
		    <div class="layui-input-inline">
			     <select name="result" lay-search="" required  lay-verify="required">
			      	<option value="">请选择</option>
						<c:forEach items="${fns:getDictList('qc_investmentDecisions_result')}" var="result">
							<option value="${result.value}">${result.label}</option>
						</c:forEach>
				 </select>
		   </div>
		</div>
		<div class="layui-form-item">
			   <div class="layui-form-item">
				  <label class="layui-form-label">决策日期:</label>
				    <div class="layui-input-inline">
				     	 <input type="text" name="decisionDate" id="decisionDate" autocomplete="off" class="layui-input">
				    </div>  
				  
				  <label class="layui-form-label">结束日期:</label>
				     <div class="layui-input-inline">
				     	 <input type="text" name="endDate" id="endDate" autocomplete="off" class="layui-input">
				    </div>
			  </div>
		 </div> 
	    <!--  <div class="layui-form-item">
			
			       <table>
			        <tr>
			         <td> <label class="layui-form-label">选择图片</label></td>
			         <td style="padding-top: 0px;"><input id="sureUploadFile" type="submit" value="确认上传"/></td>
			        </tr>
			       </table>
		</div> -->
		
		
	<div class="layui-form-item">
	   <label class="layui-form-label">附件：</label>  
		   <div class="layui-input-block">
			    <div id="fileList" class="uploader-list"></div>
				     <table>
					      <tr>
						       <td><div id="filePicker">选择附件</div></td>
						        <td style="padding-top: 0px;"><input id="sureUploadFile" type="submit" value="确认上传"/></td>
					      </tr>
			     	 </table>
		   </div>
	</div>
	<div class="layui-form-item">
		    <div class="layui-input-block">
			      <button class="layui-btn" id="submitBtn" lay-submit lay-filter="formDemo">立即提交</button>
			      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
	</div>
</form>
</div> 

<script>

layui.use(['form', 'laydate'], function(){
	var form = layui.form;
	var laydate = layui.laydate;
	var $ = layui.$;
	
	 
	//日期
	 laydate.render({
	   elem: '#decisionDate',
	   trigger: 'click', //采用click弹出
	   value: new Date()
	});  
	 laydate.render({
		   elem: '#endDate',
		   trigger: 'click', //采用click弹出
		   value: new Date()
		});  
	
	
	//表单赋值
	form.val('example', {		
		  "id": "${financial.id}"
		  ,"name": "${financial.name}"
	      ,"category": "${financial.category}"//类别
	      ,"phase":"${financial.phase}"//决策阶段
	      ,"result": "${financial.result}"//结果
	   /*    ,"rate": "${financial.rate}" */
	   	  ,"decisionDate": "${financial.decisionDate}"//开始时间
	   	   ,"endDate": "${financial.endDate}"//结束时间
	      ,"accessory": "${financial.accessory}" //附件
	      
	      /* ,"loanBalance": "${financial.loanBalance}" 
	      ,"state":"${financial.state}" 
	      ,"fild":"${financial.fild}" */
	      
 });
	//监听提交
	form.on('submit(formDemo)', function(data){
		$('#submitBtn').addClass("layui-btn-disabled").attr("disabled",true);
		var aa = JSON.stringify(data.field);
		/* alert(aa); */
		$.ajax({
            url: "${ctx}/qc/investmentDecisions/save",
            type: "POST",
            dataType: "json",
            data: {
            	dataString : aa
            },
            
            async: false,
            success: function(data){
                layer.msg(data,{time:1*500},function(){
                    var iframe_index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(iframe_index); //再执行关闭      
                    parent.layui.table.reload('thisReloadId');
                });
            },
            error: function(){
            	layer.msg('保存失败', {icon: 2});
            	$('#submitBtn').removeClass("layui-btn-disabled").attr("disabled",false);
            }
        });
		return false;
	});
	
}); 
</script>

</body> 
</html>

